import 'dart:convert';

import '../entity/MethodParams.dart';

SignTypedMethod packSignTypedMethod(String address) {
  var dataMap = {
    "domain": {
      "name": "Ether Mail",
      "version": "1",
      "chainId": 80001,
      "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
    },
    "primaryType": "Mail",
    "types": {
      "Person": [
        {
          "name": "name",
          "type": "string",
        },
        {
          "name": "wallet",
          "type": "address",
        },
      ],
      "Mail": [
        {
          "name": "from",
          "type": "Person",
        },
        {
          "name": "to",
          "type": "Person",
        },
        {
          "name": "contents",
          "type": "string",
        },
      ]
    },
    "message": {
      "from": {
        "name": "Cow",
        "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
      },
      "to": {
        "name": "Bob",
        "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
      },
      "contents": "Hello, Bob!",
    }
  };
  var data = json.encode(dataMap);
  return SignTypedMethod(address, data);
}

SignPersonalMethod packSignPersonalMethod(String message,String address){
  return SignPersonalMethod(message,address);
}